Pass Backend Object to Postprocessing Pipeline #304
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi everyone,
following my Pull Request to add a postprocessing template for the siem_rule_ndjson format for the Elasticsearch backend (SigmaHQ/pySigma-backend-elasticsearch#94) I want to propose some minor changes here to enable the
QueryTemplateTransformation
to access variables that are managed by the backend directly. For this, the backend object is passed to the Jinja render functionality. I´ve seen on Discord that this functionality was also discussed there.How to use the new Functionality:
In a postprocessing pipeline when using the
QueryTemplateTransformation
, variables managed by the backend can be accessed for example by{{ backend.variable1 }}
.One unit test was adjusted to check if the access is working correctly.
The backend object is handed over to all postprocessing transformations inside the
apply
function, however currently onlyQueryTemplateTransformation
uses the backend reference whereas the rest of the transformations do not use it because I thought that this might be the most common use case. Do you think that the other transformations should also implement some handling with this new reference?Thank you for the great project and feel free to comment and edit :)